<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../../Templates/SubFolderTemplate.xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">

    <ui:define name="head-title">
        <title>Send Invoice | Merlion's ERP System</title>
    </ui:define>

    <ui:define name="content">
        <h:form>    
                <p:dataTable var="deliveryOrder" value="#{successDeliveryOrderTable.successDeliveryOrder}" 
                         dynamic="true" paginator="true" rows="5" emptyMessage="No Finished Dilivery Order" selection="#{successDeliveryOrderTable.selectedDeliveryOrder}" onRowSelectUpdate="display">
                <p:column selectionMode="single"/>
                
                <p:column sortBy="#{deliveryOrder.id}" filterBy="#{deliveryOrder.id}"> 
                    <f:facet name="header"> 
                        <h:outputText value="Delivery Order ID" /> 
                    </f:facet> 
                    <h:outputText value="#{deliveryOrder.id}" /> 
                </p:column> 

                <p:column sortBy="#{deliveryOrder.saleOrder.id}" filterBy="#{deliveryOrder.saleOrder.id}"> 
                    <f:facet name="header"> 
                        <h:outputText value="Sale Order ID" /> 
                    </f:facet> 
                    <h:outputText value="#{deliveryOrder.saleOrder.id}" /> 
                </p:column> 

                <p:column sortBy="#{deliveryOrder.pickingOrder.id}" filterBy="#{deliveryOrder.pickingOrder.id}"> 
                    <f:facet name="header"> 
                        <h:outputText value="Picking Order ID" /> 
                    </f:facet> 
                    <h:outputText value="#{deliveryOrder.pickingOrder.id}" /> 
                </p:column>

                <p:column sortBy="#{deliveryOrder.packingOrder.id}" filterBy="#{deliveryOrder.packingOrder.id}"> 
                    <f:facet name="header"> 
                        <h:outputText value="Packing Order ID" /> 
                    </f:facet> 
                    <h:outputText value="#{deliveryOrder.packingOrder.id}" /> 
                </p:column>
                
                <p:column sortBy="#{deliveryOrder.shippingOrder.id}" filterBy="#{deliveryOrder.shippingOrder.id}"> 
                    <f:facet name="header"> 
                        <h:outputText value="Shipping Order ID" /> 
                    </f:facet> 
                    <h:outputText value="#{deliveryOrder.shippingOrder.id}" /> 
                </p:column>
                
                <p:column sortBy="#{deliveryOrder.deliveryState}" filterBy="#{deliveryOrder.deliveryState}"> 
                    <f:facet name="header"> 
                        <h:outputText value="Delivery State" /> 
                    </f:facet> 
                    <h:outputText value="#{deliveryOrder.deliveryState}" /> 
                </p:column>

                <f:facet name="footer">                     
                    <p:commandButton value="Create a Invoice" actionListener="#{successDeliveryOrderTable.createInvoice}">
                        <f:attribute name="selectedDeliveryOrder" value="#{deliveryOrder}"/>
                    </p:commandButton>  
                </f:facet>

            </p:dataTable>

        </h:form>
    </ui:define>

</ui:composition>
